<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>C Utility Functions</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Extracts-Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'C Utility Functions' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../intern.html">Inter Modules</a></li><li><a href="index.html">final</a></li><li><a href="index.html#5">Chapter 5: C</a></li><li><b>C Utility Functions</b></li></ul></div>
<p class="purpose">Rounding out the C library with a few functions intended for external code to use.</p>

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. </b>We will frequently need to reinterpret <span class="extract"><span class="extract-syntax">i7word_t</span></span> values as <span class="extract"><span class="extract-syntax">i7float_t</span></span>,
or vice versa. The following functions must be perfect inverses of each other.
</p>

<pre class="Extracts-displayed-code all-displayed-code code-font">
<span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_encode_float</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7float_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">val</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-identifier-syntax">i7float_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_decode_float</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">val</span><span class="Extracts-plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This is part of the extract file inform7_clib.h.</li></ul>
<pre class="Extracts-displayed-code all-displayed-code code-font">
<span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_encode_float</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7float_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">val</span><span class="Extracts-plain-syntax">) {</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">res</span><span class="Extracts-plain-syntax">;</span>
<span class="Extracts-plain-syntax">    *(</span><span class="Extracts-identifier-syntax">i7float_t</span><span class="Extracts-plain-syntax"> *)(&amp;</span><span class="Extracts-identifier-syntax">res</span><span class="Extracts-plain-syntax">) = </span><span class="Extracts-identifier-syntax">val</span><span class="Extracts-plain-syntax">;</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">return</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">res</span><span class="Extracts-plain-syntax">;</span>
<span class="Extracts-plain-syntax">}</span>

<span class="Extracts-identifier-syntax">i7float_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_decode_float</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">val</span><span class="Extracts-plain-syntax">) {</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">i7float_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">res</span><span class="Extracts-plain-syntax">;</span>
<span class="Extracts-plain-syntax">    *(</span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> *)(&amp;</span><span class="Extracts-identifier-syntax">res</span><span class="Extracts-plain-syntax">) = </span><span class="Extracts-identifier-syntax">val</span><span class="Extracts-plain-syntax">;</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">return</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">res</span><span class="Extracts-plain-syntax">;</span>
<span class="Extracts-plain-syntax">}</span>
</pre>
<ul class="endnotetexts"><li>This is part of the extract file inform7_clib.c.</li></ul>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b>These two functions allow external C code to read to, or write from, an
Inform 7 variable inside a currently running process.
</p>

<pre class="Extracts-displayed-code all-displayed-code code-font">
<span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_read_variable</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7process_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">var_id</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-identifier-syntax">void</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_write_variable</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7process_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">var_id</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">val</span><span class="Extracts-plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This is part of the extract file inform7_clib.h.</li></ul>
<pre class="Extracts-displayed-code all-displayed-code code-font">
<span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_read_variable</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7process_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">var_id</span><span class="Extracts-plain-syntax">) {</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">return</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">-&gt;</span><span class="Extracts-identifier-syntax">state</span><span class="Extracts-plain-syntax">.</span><span class="Extracts-identifier-syntax">variables</span><span class="Extracts-plain-syntax">[</span><span class="Extracts-identifier-syntax">var_id</span><span class="Extracts-plain-syntax">];</span>
<span class="Extracts-plain-syntax">}</span>
<span class="Extracts-identifier-syntax">void</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_write_variable</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7process_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">var_id</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">val</span><span class="Extracts-plain-syntax">) {</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">-&gt;</span><span class="Extracts-identifier-syntax">state</span><span class="Extracts-plain-syntax">.</span><span class="Extracts-identifier-syntax">variables</span><span class="Extracts-plain-syntax">[</span><span class="Extracts-identifier-syntax">var_id</span><span class="Extracts-plain-syntax">] = </span><span class="Extracts-identifier-syntax">val</span><span class="Extracts-plain-syntax">;</span>
<span class="Extracts-plain-syntax">}</span>
</pre>
<ul class="endnotetexts"><li>This is part of the extract file inform7_clib.c.</li></ul>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>Text values extracted from such variables would be difficult to interpret
from the outside because of the complex way in which text is stored within an
Inform 7 process, so the following functions allow text inside the process
to be converted to or from null-terminated C strings.
</p>

<pre class="Extracts-displayed-code all-displayed-code code-font">
<span class="Extracts-identifier-syntax">char</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">i7_read_string</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7process_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">S</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-identifier-syntax">void</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_write_string</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7process_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">S</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">char</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">A</span><span class="Extracts-plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This is part of the extract file inform7_clib.h.</li></ul>
<pre class="Extracts-displayed-code all-displayed-code code-font">
<span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_fn_TEXT_TY_Transmute</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7process_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_txt</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_fn_BlkValueRead</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7process_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_from</span><span class="Extracts-plain-syntax">,</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_pos</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_do_not_indirect</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_fn_BlkValueWrite</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7process_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_to</span><span class="Extracts-plain-syntax">,</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_pos</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_val</span><span class="Extracts-plain-syntax">,</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_do_not_indirect</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_fn_TEXT_TY_CharacterLength</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7process_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">,</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_txt</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_ch</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_i</span><span class="Extracts-plain-syntax">,</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_dsize</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_p</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_cp</span><span class="Extracts-plain-syntax">,</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_r</span><span class="Extracts-plain-syntax">);</span>

<span class="Extracts-identifier-syntax">char</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">i7_read_string</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7process_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">S</span><span class="Extracts-plain-syntax">) {</span>
<span class="Extracts-plain-syntax">    #</span><span class="Extracts-identifier-syntax">ifdef</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_BASICINFORMKIT</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">i7_fn_TEXT_TY_Transmute</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">S</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">int</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">L</span><span class="Extracts-plain-syntax"> = </span><span class="Extracts-identifier-syntax">i7_fn_TEXT_TY_CharacterLength</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">S</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">char</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">A</span><span class="Extracts-plain-syntax"> = </span><span class="Extracts-identifier-syntax">malloc</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">L</span><span class="Extracts-plain-syntax"> + </span><span class="Extracts-constant-syntax">1</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">if</span><span class="Extracts-plain-syntax"> (</span><span class="Extracts-identifier-syntax">A</span><span class="Extracts-plain-syntax"> == </span><span class="Extracts-identifier-syntax">NULL</span><span class="Extracts-plain-syntax">) {</span>
<span class="Extracts-plain-syntax">        </span><span class="Extracts-identifier-syntax">fprintf</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">stderr</span><span class="Extracts-plain-syntax">, "</span><span class="Extracts-identifier-syntax">Out</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">of</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">memory</span><span class="Extracts-plain-syntax">\</span><span class="Extracts-identifier-syntax">n</span><span class="Extracts-plain-syntax">"); </span><span class="Extracts-identifier-syntax">i7_fatal_exit</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-plain-syntax">    }</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">for</span><span class="Extracts-plain-syntax"> (</span><span class="Extracts-identifier-syntax">int</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i</span><span class="Extracts-plain-syntax">=0; </span><span class="Extracts-identifier-syntax">i</span><span class="Extracts-plain-syntax">&lt;</span><span class="Extracts-identifier-syntax">L</span><span class="Extracts-plain-syntax">; </span><span class="Extracts-identifier-syntax">i</span><span class="Extracts-plain-syntax">++)</span>
<span class="Extracts-plain-syntax">        </span><span class="Extracts-identifier-syntax">A</span><span class="Extracts-plain-syntax">[</span><span class="Extracts-identifier-syntax">i</span><span class="Extracts-plain-syntax">] = </span><span class="Extracts-identifier-syntax">i7_fn_BlkValueRead</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">S</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">A</span><span class="Extracts-plain-syntax">[</span><span class="Extracts-identifier-syntax">L</span><span class="Extracts-plain-syntax">] = </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">;</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">return</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">A</span><span class="Extracts-plain-syntax">;</span>
<span class="Extracts-plain-syntax">    #</span><span class="Extracts-identifier-syntax">endif</span>
<span class="Extracts-plain-syntax">    #</span><span class="Extracts-identifier-syntax">ifndef</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_BASICINFORMKIT</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">return</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">NULL</span><span class="Extracts-plain-syntax">;</span>
<span class="Extracts-plain-syntax">    #</span><span class="Extracts-identifier-syntax">endif</span>
<span class="Extracts-plain-syntax">}</span>

<span class="Extracts-identifier-syntax">void</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_write_string</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7process_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">S</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">char</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">A</span><span class="Extracts-plain-syntax">) {</span>
<span class="Extracts-plain-syntax">    #</span><span class="Extracts-identifier-syntax">ifdef</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_BASICINFORMKIT</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">i7_fn_TEXT_TY_Transmute</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">S</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">i7_fn_BlkValueWrite</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">S</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">if</span><span class="Extracts-plain-syntax"> (</span><span class="Extracts-identifier-syntax">A</span><span class="Extracts-plain-syntax">) {</span>
<span class="Extracts-plain-syntax">        </span><span class="Extracts-identifier-syntax">int</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">L</span><span class="Extracts-plain-syntax"> = </span><span class="Extracts-identifier-syntax">strlen</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">A</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-plain-syntax">        </span><span class="Extracts-identifier-syntax">for</span><span class="Extracts-plain-syntax"> (</span><span class="Extracts-identifier-syntax">int</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i</span><span class="Extracts-plain-syntax">=0; </span><span class="Extracts-identifier-syntax">i</span><span class="Extracts-plain-syntax">&lt;</span><span class="Extracts-identifier-syntax">L</span><span class="Extracts-plain-syntax">; </span><span class="Extracts-identifier-syntax">i</span><span class="Extracts-plain-syntax">++)</span>
<span class="Extracts-plain-syntax">            </span><span class="Extracts-identifier-syntax">i7_fn_BlkValueWrite</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">S</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">A</span><span class="Extracts-plain-syntax">[</span><span class="Extracts-identifier-syntax">i</span><span class="Extracts-plain-syntax">], </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-plain-syntax">    }</span>
<span class="Extracts-plain-syntax">    #</span><span class="Extracts-identifier-syntax">endif</span>
<span class="Extracts-plain-syntax">}</span>
</pre>
<ul class="endnotetexts"><li>This is part of the extract file inform7_clib.c.</li></ul>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b>And similarly for list values, which we convert to and from C arrays.
</p>

<pre class="Extracts-displayed-code all-displayed-code code-font">
<span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">i7_read_list</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7process_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">S</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">int</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">N</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-identifier-syntax">void</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_write_list</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7process_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">S</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">A</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">int</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">L</span><span class="Extracts-plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This is part of the extract file inform7_clib.h.</li></ul>
<pre class="Extracts-displayed-code all-displayed-code code-font">
<span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_fn_LIST_OF_TY_GetLength</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7process_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_list</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_fn_LIST_OF_TY_SetLength</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7process_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_list</span><span class="Extracts-plain-syntax">,</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_newsize</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_this_way_only</span><span class="Extracts-plain-syntax">,</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_truncation_end</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_no_items</span><span class="Extracts-plain-syntax">,</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_ex</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_i</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_dv</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_fn_LIST_OF_TY_GetItem</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7process_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_list</span><span class="Extracts-plain-syntax">,</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_i</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_forgive</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_no_items</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_fn_LIST_OF_TY_PutItem</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7process_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_list</span><span class="Extracts-plain-syntax">,</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_i</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_v</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_no_items</span><span class="Extracts-plain-syntax">,</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_nv</span><span class="Extracts-plain-syntax">);</span>

<span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">i7_read_list</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7process_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">S</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">int</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">N</span><span class="Extracts-plain-syntax">) {</span>
<span class="Extracts-plain-syntax">    #</span><span class="Extracts-identifier-syntax">ifdef</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_BASICINFORMKIT</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">int</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">L</span><span class="Extracts-plain-syntax"> = </span><span class="Extracts-identifier-syntax">i7_fn_LIST_OF_TY_GetLength</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">S</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">A</span><span class="Extracts-plain-syntax"> = </span><span class="Extracts-identifier-syntax">calloc</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">L</span><span class="Extracts-plain-syntax"> + </span><span class="Extracts-constant-syntax">1</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">sizeof</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax">));</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">if</span><span class="Extracts-plain-syntax"> (</span><span class="Extracts-identifier-syntax">A</span><span class="Extracts-plain-syntax"> == </span><span class="Extracts-identifier-syntax">NULL</span><span class="Extracts-plain-syntax">) {</span>
<span class="Extracts-plain-syntax">        </span><span class="Extracts-identifier-syntax">fprintf</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">stderr</span><span class="Extracts-plain-syntax">, "</span><span class="Extracts-identifier-syntax">Out</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">of</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">memory</span><span class="Extracts-plain-syntax">\</span><span class="Extracts-identifier-syntax">n</span><span class="Extracts-plain-syntax">"); </span><span class="Extracts-identifier-syntax">i7_fatal_exit</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-plain-syntax">    }</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">for</span><span class="Extracts-plain-syntax"> (</span><span class="Extracts-identifier-syntax">int</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i</span><span class="Extracts-plain-syntax">=0; </span><span class="Extracts-identifier-syntax">i</span><span class="Extracts-plain-syntax">&lt;</span><span class="Extracts-identifier-syntax">L</span><span class="Extracts-plain-syntax">; </span><span class="Extracts-identifier-syntax">i</span><span class="Extracts-plain-syntax">++) </span><span class="Extracts-identifier-syntax">A</span><span class="Extracts-plain-syntax">[</span><span class="Extracts-identifier-syntax">i</span><span class="Extracts-plain-syntax">] = </span><span class="Extracts-identifier-syntax">i7_fn_LIST_OF_TY_GetItem</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">S</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i</span><span class="Extracts-plain-syntax">+1, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">A</span><span class="Extracts-plain-syntax">[</span><span class="Extracts-identifier-syntax">L</span><span class="Extracts-plain-syntax">] = </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">;</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">if</span><span class="Extracts-plain-syntax"> (</span><span class="Extracts-identifier-syntax">N</span><span class="Extracts-plain-syntax">) *</span><span class="Extracts-identifier-syntax">N</span><span class="Extracts-plain-syntax"> = </span><span class="Extracts-identifier-syntax">L</span><span class="Extracts-plain-syntax">;</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">return</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">A</span><span class="Extracts-plain-syntax">;</span>
<span class="Extracts-plain-syntax">    #</span><span class="Extracts-identifier-syntax">endif</span>
<span class="Extracts-plain-syntax">    #</span><span class="Extracts-identifier-syntax">ifndef</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_BASICINFORMKIT</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">return</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">NULL</span><span class="Extracts-plain-syntax">;</span>
<span class="Extracts-plain-syntax">    #</span><span class="Extracts-identifier-syntax">endif</span>
<span class="Extracts-plain-syntax">}</span>

<span class="Extracts-identifier-syntax">void</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_write_list</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7process_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">S</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">A</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">int</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">L</span><span class="Extracts-plain-syntax">) {</span>
<span class="Extracts-plain-syntax">    #</span><span class="Extracts-identifier-syntax">ifdef</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_BASICINFORMKIT</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">i7_fn_LIST_OF_TY_SetLength</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">S</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">L</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">if</span><span class="Extracts-plain-syntax"> (</span><span class="Extracts-identifier-syntax">A</span><span class="Extracts-plain-syntax">) {</span>
<span class="Extracts-plain-syntax">        </span><span class="Extracts-identifier-syntax">for</span><span class="Extracts-plain-syntax"> (</span><span class="Extracts-identifier-syntax">int</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i</span><span class="Extracts-plain-syntax">=0; </span><span class="Extracts-identifier-syntax">i</span><span class="Extracts-plain-syntax">&lt;</span><span class="Extracts-identifier-syntax">L</span><span class="Extracts-plain-syntax">; </span><span class="Extracts-identifier-syntax">i</span><span class="Extracts-plain-syntax">++)</span>
<span class="Extracts-plain-syntax">            </span><span class="Extracts-identifier-syntax">i7_fn_LIST_OF_TY_PutItem</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">S</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i</span><span class="Extracts-plain-syntax">+1, </span><span class="Extracts-identifier-syntax">A</span><span class="Extracts-plain-syntax">[</span><span class="Extracts-identifier-syntax">i</span><span class="Extracts-plain-syntax">], </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-plain-syntax">    }</span>
<span class="Extracts-plain-syntax">    #</span><span class="Extracts-identifier-syntax">endif</span>
<span class="Extracts-plain-syntax">}</span>
</pre>
<ul class="endnotetexts"><li>This is part of the extract file inform7_clib.c.</li></ul>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>Lastly, this function allows an action to be tried &mdash; something which is only
meaningful in an Inform project which uses WorldModelKit: it will fail in a
Basic Inform only project.
</p>

<pre class="Extracts-displayed-code all-displayed-code code-font">
<span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_try</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7process_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">action_id</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">n</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">s</span><span class="Extracts-plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This is part of the extract file inform7_clib.h.</li></ul>
<pre class="Extracts-displayed-code all-displayed-code code-font">
<span class="Extracts-plain-syntax">#</span><span class="Extracts-identifier-syntax">ifdef</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_TryAction</span>
<span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_fn_TryAction</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7process_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_req</span><span class="Extracts-plain-syntax">,</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_by</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_ac</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_n</span><span class="Extracts-plain-syntax">,</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_s</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_stora</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_smeta</span><span class="Extracts-plain-syntax">,</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_tbits</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_saved_command</span><span class="Extracts-plain-syntax">,</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_mgl_local_text_of_command</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_try</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">i7process_t</span><span class="Extracts-plain-syntax"> *</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">action_id</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">n</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">i7word_t</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">s</span><span class="Extracts-plain-syntax">) {</span>
<span class="Extracts-plain-syntax">    </span><span class="Extracts-identifier-syntax">return</span><span class="Extracts-plain-syntax"> </span><span class="Extracts-identifier-syntax">i7_fn_TryAction</span><span class="Extracts-plain-syntax">(</span><span class="Extracts-identifier-syntax">proc</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">action_id</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">n</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-identifier-syntax">s</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">, </span><span class="Extracts-constant-syntax">0</span><span class="Extracts-plain-syntax">);</span>
<span class="Extracts-plain-syntax">}</span>
<span class="Extracts-plain-syntax">#</span><span class="Extracts-identifier-syntax">endif</span>
</pre>
<ul class="endnotetexts"><li>This is part of the extract file inform7_clib.c.</li></ul>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. </b>Because the C library file and its header are both wrapped inside conditional
compilations to guard against errors if they are included more than once, those
conditionals both need to be ended. So this is the bottom of both files: finis.
</p>

<pre class="Extracts-displayed-code all-displayed-code code-font">
<span class="Extracts-plain-syntax">#</span><span class="Extracts-identifier-syntax">endif</span>
</pre>
<ul class="endnotetexts"><li>This is part of the extract file inform7_clib.h.</li></ul>
<pre class="Extracts-displayed-code all-displayed-code code-font">
<span class="Extracts-plain-syntax">#</span><span class="Extracts-identifier-syntax">endif</span>
</pre>
<ul class="endnotetexts"><li>This is part of the extract file inform7_clib.c.</li></ul>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="5-cmn.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-fm.html">1</a></li><li class="progresschapter"><a href="2-cg.html">2</a></li><li class="progresschapter"><a href="3-fti.html">3</a></li><li class="progresschapter"><a href="4-fi6.html">4</a></li><li class="progresscurrentchapter">5</li><li class="progresssection"><a href="5-fnc.html">fnc</a></li><li class="progresssection"><a href="5-cnm.html">cnm</a></li><li class="progresssection"><a href="5-crf.html">crf</a></li><li class="progresssection"><a href="5-cgv.html">cgv</a></li><li class="progresssection"><a href="5-cmm.html">cmm</a></li><li class="progresssection"><a href="5-cas.html">cas</a></li><li class="progresssection"><a href="5-car.html">car</a></li><li class="progresssection"><a href="5-cpc.html">cpc</a></li><li class="progresssection"><a href="5-ccn.html">ccn</a></li><li class="progresssection"><a href="5-clt.html">clt</a></li><li class="progresssection"><a href="5-com.html">com</a></li><li class="progresssection"><a href="5-cfm.html">cfm</a></li><li class="progresssection"><a href="5-cim.html">cim</a></li><li class="progresssection"><a href="5-cmn.html">cmn</a></li><li class="progresscurrent">cuf</li><li class="progressnextoff">&#10095;</li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

